﻿using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.UI.WebControls;

namespace JsonResultMvc.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewData["Message"] = "Welcome to ASP.NET MVC!";

            return View();
        }

        public JsonResult GetData()
        {
            List<ListItem> list = new List<ListItem>() {
                new ListItem() { Text = "Keyvan Nayyeri" },
                new ListItem() { Text = "Simone Chiaretta" },
                new ListItem() { Text = "Scott Guthrie" },
                new ListItem() { Text = "Scott Hanselman" },
                new ListItem() { Text = "Phil Haack" },
                new ListItem() { Text = "Rob Conery" }
            };

            return this.Json(list);
        }
    }
}
